package com.wanxi.repertory.service.api.feign;

import com.wanxi.repertory.service.api.query.RepertoryQuery;
import com.wanxi.repertory.service.api.result.CommonResult;
import com.wanxi.repertory.service.api.vo.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "repertory-server")
@RequestMapping("/repertory")
public interface RepertoryShopService {
    /**
     * 根据店铺id查找店铺下所有sku id
     * @param shopId
     * @return
     */
    @GetMapping("/sku/findSkuIdByShopId")
    CommonResult<List<Long>> findSkuIdByShopId(@RequestParam(name = "shopId") Long shopId);

    /**
     * 查找商品id根据销售量排序
     * @return
     */
    @GetMapping("/sku/findSkuIdDescSaleTotal")
    CommonResult<List<Long>> findSkuIdDescSaleTotal();

    /**
     * 通过skuId查找销售量与剩余库存
     * @param skuId
     * @return
     */
    @GetMapping("/total/findBySkuId")
    CommonResult<RepertoryTotalFindByIdOutVo> findTotalBySkuId(@RequestParam(name = "skuId") Long skuId);

    /**
     * 修改库存量与商品上下架
     * @param repertoryUpdateInVo
     * @return
     */
    @PutMapping("/total/update")
    CommonResult updateTotal(@RequestBody RepertoryTotalUpdateInVo repertoryUpdateInVo);

    /**
     * 分配库存
     * @param skuAllocateInVo
     * @return
     */
    @PutMapping("/total/allocate")
    CommonResult allocate(@RequestBody RepertoryTotalAllocateInVo skuAllocateInVo);

    /**
     * 添加库存流水记录
     * @param repertoryAddInVo
     * @return
     */
    @GetMapping("/record/add")
    CommonResult<Long> addRecord(@RequestBody RepertoryRecordAddInVo repertoryAddInVo);

    /**
     * 获取库存流水列表
     * @param repertoryQuery
     * @return
     */
    @GetMapping("/record/findAll")
    CommonResult<RepertoryRecordFindAllOutVo> findAllRecord(@RequestBody RepertoryQuery repertoryQuery);

    /**
     * 根据id查找库存流水
     * @param repertoryId
     * @return
     */
    @GetMapping("/record/findById")
    CommonResult<RepertoryRecordFindByIdOutVo> findRecordById(@RequestParam(name = "repertoryId") Long repertoryId);


}
